package logic

import (
	"Wei-Xin/models"
	"context"

	"Wei-Xin/weixinrpc/internal/svc"
	"Wei-Xin/weixinrpc/weixinrpc"

	"github.com/zeromicro/go-zero/core/logx"
)

type MomentListLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
	logx.Logger
}

func NewMomentListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *MomentListLogic {
	return &MomentListLogic{
		ctx:    ctx,
		svcCtx: svcCtx,
		Logger: logx.WithContext(ctx),
	}
}

// 朋友圈列表
func (l *MomentListLogic) MomentList(in *weixinrpc.MomentListRequest) (*weixinrpc.MomentListResponse, error) {
	// todo: add your logic here and delete this line

	var moment models.Moment

	list, err := moment.MomentList(models.DB, in)
	if err != nil {
		return nil, err
	}
	
	return &weixinrpc.MomentListResponse{
		List: list,
	}, nil
}
